<!DOCTYPE html>
<html>
	<head>
        <meta charset="utf-8" />
		<title>Benchmark</title>
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script src="http://code.highcharts.com/highcharts.js"></script>
        <script src="http://code.highcharts.com/modules/data.js"></script>
        <script src="http://code.highcharts.com/modules/exporting.js"></script>
        <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
        <script>
        $.get('bench_str.csv', function(data) {



        var options = {
            chart: {
                zoomType: 'x',
            },

            /*
            data: {
                csv: data,
                parseDate: function (s) {
                    var match = s.match(/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2})$/);
                    if (match) {
                        return Date.UTC(+('20' + match[3]), match[1] - 1, +match[2]);
                    }
                }
            },
            */

            title: {
                text: 'Matching Speed'
            },

            subtitle: {
                text: 'testing with 336 routes'
            },

            xAxis: {
                type: 'datetime',
                // tickInterval: 7 * 24 * 3600 * 1000, // one week
                labels: {
                    align: 'left',
                    x: 3,
                    y: -3
                }
            },

            yAxis: [{ // left y axis
                title: {
                    text: null
                },
                labels: {
                    align: 'left',
                    x: 3,
                    y: 16,
                    format: '{value:.,0f}'
                },
                showFirstLabel: false
            }],

            legend: {
                align: 'right',
                verticalAlign: 'top',
                y: 50,
                floating: false,
                layout: 'vertical',
                background: '#fff',
                borderWidth: 1,
            },

            tooltip: {
                shared: true,
                crosshairs: true
            },

            plotOptions: {
                /*
                area: {
                    fillColor: {
                        linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1},
                        stops: [
                            [0, Highcharts.getOptions().colors[0]],
                            [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
                        ]
                    },
                    marker: {
                        radius: 2
                    },
                    lineWidth: 1,
                    states: {
                        hover: {
                            lineWidth: 1
                        }
                    },
                    threshold: null
                }
                */
            },

            series: [
                {
                    type: 'area',
                    name: 'string matching',
                    pointInterval: 1000,
                    lineWidth: 1,
                    marker: {
                        radius: 3
                    },
                    pointStart: Date.UTC(2014, 5, 16),
                    data: []
                },
                {
                    type: 'area',
                    name: 'simple pattern matching',
                    pointInterval: 1000,
                    lineWidth: 1,
                    marker: {
                        radius: 3
                    },
                    pointStart: Date.UTC(2014, 5, 16),
                    data: []
                },
                {
                    type: 'area',
                    name: 'tree_compile',
                    pointInterval: 1000,
                    lineWidth: 1,
                    marker: {
                        radius: 3
                    },
                    pointStart: Date.UTC(2014, 5, 16),
                    data: []
                },
                {
                    type: 'area',
                    name: 'match_entry with str',
                    pointInterval: 1000,
                    lineWidth: 1,
                    marker: {
                        radius: 3
                    },
                    pointStart: Date.UTC(2014, 5, 16),
                    data: []
                }
            ]
        };

        var lines = data.split(/\n/);

        // keep window size to 30 records
        lines.splice(-30);
        lines = lines.splice(lines.length - 30);

        $(lines).each(function(i,line) {
            var columns = line.split(/,/);
            var a;
            a = parseInt(columns[1]);
            options.series[0].data.push(a || 0);

            a = parseInt(columns[2]);
            options.series[1].data.push(a || 0);

            a = parseInt(columns[3]);
            options.series[2].data.push(a || 0);

            a = parseInt(columns[4]);
            options.series[3].data.push(a || 0);
        });

        $('#chart').highcharts(options);
});
        </script>
	</head>
	<body>
        <div class="container">

        <h1>R3: Router Benchmark</h1>

        <div id="chart" style="width: 100%; height: 450px; margin: 0 auto"></div>

        <h2>Data Set</h2>

<p>This testing data is from <a href="https://github.com/stevegraham/rails/pull/1">https://github.com/stevegraham/rails/pull/1</a></p>

<pre>/foo/bar/baz
/foo/bar/qux
/foo/bar/quux
/foo/bar/corge
/foo/bar/grault
/foo/bar/garply
/foo/baz/bar
/foo/baz/qux
/foo/baz/quux
/foo/baz/corge
/foo/baz/grault
/foo/baz/garply
/foo/qux/bar
/foo/qux/baz
/foo/qux/quux
/foo/qux/corge
/foo/qux/grault
/foo/qux/garply
/foo/quux/bar
/foo/quux/baz
/foo/quux/qux
/foo/quux/corge
/foo/quux/grault
/foo/quux/garply
/foo/corge/bar
/foo/corge/baz
/foo/corge/qux
/foo/corge/quux
/foo/corge/grault
/foo/corge/garply
/foo/grault/bar
/foo/grault/baz
/foo/grault/qux
/foo/grault/quux
/foo/grault/corge
/foo/grault/garply
/foo/garply/bar
/foo/garply/baz
/foo/garply/qux
/foo/garply/quux
/foo/garply/corge
/foo/garply/grault
/bar/foo/baz
/bar/foo/qux
/bar/foo/quux
/bar/foo/corge
/bar/foo/grault
/bar/foo/garply
/bar/baz/foo
/bar/baz/qux
/bar/baz/quux
/bar/baz/corge
/bar/baz/grault
/bar/baz/garply
/bar/qux/foo
/bar/qux/baz
/bar/qux/quux
/bar/qux/corge
/bar/qux/grault
/bar/qux/garply
/bar/quux/foo
/bar/quux/baz
/bar/quux/qux
/bar/quux/corge
/bar/quux/grault
/bar/quux/garply
/bar/corge/foo
/bar/corge/baz
/bar/corge/qux
/bar/corge/quux
/bar/corge/grault
/bar/corge/garply
/bar/grault/foo
/bar/grault/baz
/bar/grault/qux
/bar/grault/quux
/bar/grault/corge
/bar/grault/garply
/bar/garply/foo
/bar/garply/baz
/bar/garply/qux
/bar/garply/quux
/bar/garply/corge
/bar/garply/grault
/baz/foo/bar
/baz/foo/qux
/baz/foo/quux
/baz/foo/corge
/baz/foo/grault
/baz/foo/garply
/baz/bar/foo
/baz/bar/qux
/baz/bar/quux
/baz/bar/corge
/baz/bar/grault
/baz/bar/garply
/baz/qux/foo
/baz/qux/bar
/baz/qux/quux
/baz/qux/corge
/baz/qux/grault
/baz/qux/garply
/baz/quux/foo
/baz/quux/bar
/baz/quux/qux
/baz/quux/corge
/baz/quux/grault
/baz/quux/garply
/baz/corge/foo
/baz/corge/bar
/baz/corge/qux
/baz/corge/quux
/baz/corge/grault
/baz/corge/garply
/baz/grault/foo
/baz/grault/bar
/baz/grault/qux
/baz/grault/quux
/baz/grault/corge
/baz/grault/garply
/baz/garply/foo
/baz/garply/bar
/baz/garply/qux
/baz/garply/quux
/baz/garply/corge
/baz/garply/grault
/qux/foo/bar
/qux/foo/baz
/qux/foo/quux
/qux/foo/corge
/qux/foo/grault
/qux/foo/garply
/qux/bar/foo
/qux/bar/baz
/qux/bar/quux
/qux/bar/corge
/qux/bar/grault
/qux/bar/garply
/qux/baz/foo
/qux/baz/bar
/qux/baz/quux
/qux/baz/corge
/qux/baz/grault
/qux/baz/garply
/qux/quux/foo
/qux/quux/bar
/qux/quux/baz
/qux/quux/corge
/qux/quux/grault
/qux/quux/garply
/qux/corge/foo
/qux/corge/bar
/qux/corge/baz
/qux/corge/quux
/qux/corge/grault
/qux/corge/garply
/qux/grault/foo
/qux/grault/bar
/qux/grault/baz
/qux/grault/quux
/qux/grault/corge
/qux/grault/garply
/qux/garply/foo
/qux/garply/bar
/qux/garply/baz
/qux/garply/quux
/qux/garply/corge
/qux/garply/grault
/quux/foo/bar
/quux/foo/baz
/quux/foo/qux
/quux/foo/corge
/quux/foo/grault
/quux/foo/garply
/quux/bar/foo
/quux/bar/baz
/quux/bar/qux
/quux/bar/corge
/quux/bar/grault
/quux/bar/garply
/quux/baz/foo
/quux/baz/bar
/quux/baz/qux
/quux/baz/corge
/quux/baz/grault
/quux/baz/garply
/quux/qux/foo
/quux/qux/bar
/quux/qux/baz
/quux/qux/corge
/quux/qux/grault
/quux/qux/garply
/quux/corge/foo
/quux/corge/bar
/quux/corge/baz
/quux/corge/qux
/quux/corge/grault
/quux/corge/garply
/quux/grault/foo
/quux/grault/bar
/quux/grault/baz
/quux/grault/qux
/quux/grault/corge
/quux/grault/garply
/quux/garply/foo
/quux/garply/bar
/quux/garply/baz
/quux/garply/qux
/quux/garply/corge
/quux/garply/grault
/corge/foo/bar
/corge/foo/baz
/corge/foo/qux
/corge/foo/quux
/corge/foo/grault
/corge/foo/garply
/corge/bar/foo
/corge/bar/baz
/corge/bar/qux
/corge/bar/quux
/corge/bar/grault
/corge/bar/garply
/corge/baz/foo
/corge/baz/bar
/corge/baz/qux
/corge/baz/quux
/corge/baz/grault
/corge/baz/garply
/corge/qux/foo
/corge/qux/bar
/corge/qux/baz
/corge/qux/quux
/corge/qux/grault
/corge/qux/garply
/corge/quux/foo
/corge/quux/bar
/corge/quux/baz
/corge/quux/qux
/corge/quux/grault
/corge/quux/garply
/corge/grault/foo
/corge/grault/bar
/corge/grault/baz
/corge/grault/qux
/corge/grault/quux
/corge/grault/garply
/corge/garply/foo
/corge/garply/bar
/corge/garply/baz
/corge/garply/qux
/corge/garply/quux
/corge/garply/grault
/grault/foo/bar
/grault/foo/baz
/grault/foo/qux
/grault/foo/quux
/grault/foo/corge
/grault/foo/garply
/grault/bar/foo
/grault/bar/baz
/grault/bar/qux
/grault/bar/quux
/grault/bar/corge
/grault/bar/garply
/grault/baz/foo
/grault/baz/bar
/grault/baz/qux
/grault/baz/quux
/grault/baz/corge
/grault/baz/garply
/grault/qux/foo
/grault/qux/bar
/grault/qux/baz
/grault/qux/quux
/grault/qux/corge
/grault/qux/garply
/grault/quux/foo
/grault/quux/bar
/grault/quux/baz
/grault/quux/qux
/grault/quux/corge
/grault/quux/garply
/grault/corge/foo
/grault/corge/bar
/grault/corge/baz
/grault/corge/qux
/grault/corge/quux
/grault/corge/garply
/grault/garply/foo
/grault/garply/bar
/grault/garply/baz
/grault/garply/qux
/grault/garply/quux
/grault/garply/corge
/garply/foo/bar
/garply/foo/baz
/garply/foo/qux
/garply/foo/quux
/garply/foo/corge
/garply/foo/grault
/garply/bar/foo
/garply/bar/baz
/garply/bar/qux
/garply/bar/quux
/garply/bar/corge
/garply/bar/grault
/garply/baz/foo
/garply/baz/bar
/garply/baz/qux
/garply/baz/quux
/garply/baz/corge
/garply/baz/grault
/garply/qux/foo
/garply/qux/bar
/garply/qux/baz
/garply/qux/quux
/garply/qux/corge
/garply/qux/grault
/garply/quux/foo
/garply/quux/bar
/garply/quux/baz
/garply/quux/qux
/garply/quux/corge
/garply/quux/grault
/garply/corge/foo
/garply/corge/bar
/garply/corge/baz
/garply/corge/qux
/garply/corge/quux
/garply/corge/grault
/garply/grault/foo
/garply/grault/bar
/garply/grault/baz
/garply/grault/qux
/garply/grault/quux
/garply/grault/corge
</pre>
    </div>


<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-2196512-14', 'c9s.github.io');
  ga('send', 'pageview');

</script>
</body>
</html>
